package com.mini.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mini.config.EncryptField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author shixiaopeng  on 2020/12/9
 */
@Data
public class BusinessCallInfoVO implements Serializable {

    @ApiModelProperty(value = "通道ID")
    private String channelId;

    @ApiModelProperty(value = "运营专员ID")
    private Long userId;

    @ApiModelProperty(value = "主叫号码")
    private String caller;

    @ApiModelProperty(value = "被叫号码")
    @EncryptField
    private String callee;

    @ApiModelProperty(value = "电话接通时间")
    private String startTime;

    @ApiModelProperty(value = "电话挂断时间")
    private String endTime;

    @ApiModelProperty(value = "通话时长")
    private Integer duration;

    @ApiModelProperty(value = "响铃时间")
    private String ringTime;

    @ApiModelProperty(value = "响铃时长")
    private Integer ringTimeLen;

    @ApiModelProperty(value = "呼叫类型")
    private String alicomRtcType;

    @ApiModelProperty(value = "录音文件URL")
    private String recordFile;

    @ApiModelProperty(value = "oss录音地址")
    private String localRecordFile;

    @ApiModelProperty(value = "通话备注")
    private String callDesc;

    @ApiModelProperty(value = "接听状态 0-未接通 1-已接通")
    private Integer answerStatus;

    @ApiModelProperty(value = "sku标识")
    private Long skuId;

    @ApiModelProperty(value = "呼叫记录ID")
    private String callId;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "产品类型 A-阿里 T-腾讯")
    private String productCode;

    public enum AnswerStatusEnum{
        connected(1,"已接通"),
        unconnected(0, "未接通"),
        ;
        public final Integer code;
        public final String desc;

        AnswerStatusEnum(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static AnswerStatusEnum getStatus(int code) {
            for (AnswerStatusEnum field : AnswerStatusEnum.values()) {
                if (code == field.code) {
                    return field;
                }
            }
            return null;
        }
    }
}
